import { defineStore } from "pinia";
import { ref, computed } from "vue";

// 第二个参数如果是函数，表示用的是组合式的写法
export const useCityStore = defineStore("city", () => {
  // state,getters,actions

  const cityname = ref<string>("北京");
  const doublename = computed<string>(() => cityname.value + cityname.value);

  const changecity = (): void => {
    cityname.value = "杭州";
  };

  return {
    cityname,
    doublename,
    changecity,
  };
});
